//
//  AdressTableViewCell.m
//  UI_通讯录.通讯录.
//
//  Created by 男哥呵呵 on 16/1/21.
//  Copyright © 2016年 Mr.x. All rights reserved.
//

#import "AdressTableViewCell.h"


@implementation AdressTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.headView = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.headView];
        
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.nameLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.nameLabel];
        
        self.phoneNumLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.phoneNumLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.phoneNumLabel];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.headView.frame = CGRectMake(0, 0, self.contentView.frame.size.width / 3, self.contentView.frame.size.height);
    
    self.nameLabel.frame = CGRectMake(self.contentView.frame.size.width / 3, 0, self.contentView.frame.size.width / 3 * 2, self.contentView.frame.size.height / 2);
    
    self.phoneNumLabel.frame = CGRectMake(self.contentView.frame.size.width / 3, self.contentView.frame.size.height / 2, self.contentView.frame.size.width / 3 * 2, self.contentView.frame.size.height / 2);
    
}

- (void)setModel:(AdressBookModel *)model {
    _model = model;
    self.headView.image = model.image;
    self.nameLabel.text = model.name;
    self.phoneNumLabel.text = model.phoneNum;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
